from gevent import monkey

monkey.patch_all()
from gevent.pool import Pool
import requests


def download(url):
    print('Visit --> %s' % url)
    try:
        res = requests.get(url)
        data = res.text
        print('%s bytes received from %s' % (len(data), url))
    except Exception as value:
        print(value)
    return 'url:%s --> finished' % url


if __name__ == '__main__':
    urls = ['https://www.baidu.com/', 'https://www.163.com/', 'https://www.python.org/']
    pool = Pool(2)
    result = pool.map(download, urls)
    print(result)
